#ifndef CRAPSSQL_H
#define CRAPSSQL_H

#include "tbllim.h"
#include "GameDBInterface.h"
#include "tracksql.h"
#include "crapconn.h"

class CrapsRound;
class CrapsSavedGame;

// kharmon.  06-16-06.  #3077.  SicBo Implementation.  Now we derive from the GameDBInterface.
// This class is now the interface between the craps game object and the database.
class CrapsSQL : public GameDBInterface
{
public:

    CrapsSQL(CrapsConnection *pConn, TrackSQL *pSQL);

    virtual ~CrapsSQL();
       
	bool8	trackRoll(uint8 point, uint8 die1, uint8 die2,
				CrapsRound *round, CrapsRound *current, 
				int32 *betAmounts, int32 *bonusPayAmounts,
				int32 totalWinningBets, int32 continueBets, int32 continueBonusBets, 
				int32 payout, int32 bonusPayout, int32 *balance,
				int32 *compBalance, int32 *bonusBalance);

	bool8	trackScrubBet(uint8 betID);		

    // called when the play initially connect to load the table limits and any other game options
	bool8	trackLoadOptions();     

	bool8	trackHasSavedGame(DiceGame *& pGame, int32 *err);

    CTableLimits * getTableLimits() { return tableLimits; }     // kharmon.  06-16-06.  #3077.

	// CSN-5666: tool to force craps results
	String getForcedRolls(const PID& pid, int32 gameId, uint8 machId);

protected:

	int32 roll(int32 casinoId,
		const PID&, CrapsGameID gid, bool8 forMoney, SESSIONID, int32 compFactor,
		uint8 point, uint8 die1, uint8 die2,
		CrapsRound *round, CrapsRound *current, 
		int32 *betAmounts, int32 *bonusPayAmounts,
		int32 totalWinningBets, int32 continueBets, int32 continueBonusBets,
		int32 payout, int32 bonusPayout,
		int32* balance, int32* compBalance, int32 *bonusBalance);

	int32 getPlayerLimits(const PID&, int32 gameId, uint8 machId, CTableLimits *limits);

	int32 hasSavedGame(const PID& pid, CrapsGameID gid, bool8 forMoney,
		CrapsSavedGame *sg, bool8 *exists);

	int32 scrubBet(CrapsGameID gid, uint8 betID, const PID& pid);

    // kharmon.  06-16-06.  #3077.  This is kept here now.
    CTableLimits	*tableLimits;

};

#endif